package com.elinkway.infinitemovies.utils;

import android.graphics.Bitmap;
import android.text.TextUtils;

import java.io.File;
import java.io.IOException;
import java.io.Serializable;


public class ImageItem implements Serializable {
	public String imageId;
	public String thumbnailPath;
	public String imagePath;
	public Bitmap bitmap;
	public File file;
	public boolean isSelected = false;

	@Override
	public boolean equals(Object imageItem) {
		if (imageItem == this) {
			return true;
		}
		if (imageItem instanceof ImageItem) {
			ImageItem im = (ImageItem)imageItem;
			if (TextUtils.isEmpty(this.getImagePath()) ||
					TextUtils.isEmpty(im.getImagePath())) {
				return false;
			}
			return this.getImagePath().equals(im.getImagePath());
		} else {
			return false;
		}
	}
	public String getImageId() {
		return imageId;
	}
	public void setImageId(String imageId) {
		this.imageId = imageId;
	}
	public String getThumbnailPath() {
		return thumbnailPath;
	}
	public void setThumbnailPath(String thumbnailPath) {
		this.thumbnailPath = thumbnailPath;
	}
	public String getImagePath() {
		return imagePath;
	}
	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}
	public boolean isSelected() {
		return isSelected;
	}
	public void setSelected(boolean isSelected) {
		this.isSelected = isSelected;
	}
	public Bitmap getBitmap() {
		if(bitmap == null){
			try {
				bitmap = BitmapUtils.revitionImageSize(imagePath);
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return bitmap;
	}
	public void setBitmap(Bitmap bitmap) {
		this.bitmap = bitmap;
	}
	public void setBitFile(File file) {
		this.file = file;
	}

	public File getBitFile() {
		return this.file;
	}
	
	
	
}
